//
//  UPOrderCategoryCell.m
//  LoveBee
//
//  Created by wyzc on 16/6/20.
//  Copyright © 2016年 叶落知秋. All rights reserved.
//

#import "UPOrderCategoryCell.h"
#import "HROrderCategoryModel.h"
@interface UPOrderCategoryCell () 
@property (weak, nonatomic) IBOutlet UIView *leftView;
@property (weak, nonatomic) IBOutlet UILabel *nameLabel;
@property (weak, nonatomic) IBOutlet UIImageView *rightImageView;

@end
@implementation UPOrderCategoryCell

-(void)setModel:(HROrderCategoryModel *)model
{
    _model=model;
    self.nameLabel.text=model.name;
    if (model.flag.length) {
        dispatch_queue_t
        queue=dispatch_queue_create("abc", NULL);
        dispatch_async(queue, ^{
            NSURL *url=[NSURL URLWithString:model.flag];
            NSData *data=[NSData dataWithContentsOfURL:url];
            dispatch_async(dispatch_get_main_queue(),^{
                UIImage *img=[UIImage imageWithData:data];
                self.rightImageView.image=img;
            });
        });
        
    }
    
}

- (void)awakeFromNib {
    [super awakeFromNib];
    self.nameLabel.textColor=HRCOLOR(169, 169, 169);
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];
    //当选中cell的时候左边的黄线出现
    self.leftView.hidden=!selected;
    if (selected) {
        self.backgroundColor=[UIColor whiteColor];
        self.nameLabel.textColor=[UIColor blackColor];
    }else{
        self.backgroundColor=[UIColor clearColor];
        self.nameLabel.textColor=HRCOLOR(169, 169, 169);
    }


}

@end
